package com.baiyang.app.tool;

import android.app.Activity;
import android.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;

public abstract class AlertUtil {
    private AlertDialog alert = null;
    private AlertDialog.Builder builder = null;
    private View view;
    public AlertUtil(final Activity activity, final int id, final Boolean bool){
        builder = new AlertDialog.Builder(activity);
        final LayoutInflater inflater = activity.getLayoutInflater();
        view = inflater.inflate(id, null,false);
        builder.setView(view);
        builder.setCancelable(bool);
        alert = builder.create();
        setView(view);
    }
    public abstract void setView(View view);
    public void show(){
        alert.show();
    }
    public void dismiss(){
        alert.dismiss();
    }
    public View getView(){
        return view;
    };
}
